package com.xiaoq.sites.endpoint;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xiaoq.RedisTemplate4JedisCluster;
import com.xiaoq.apis.user.IMerchantMgrApi;
import com.xiaoq.apis.user.MerchantMgrInfo4Vo;
import com.xiaoq.coms.GenericDataResponse;
import com.xiaoq.coms.GenericResponse;
import com.xiaoq.coms.util.ConstantUtil;
import com.xiaoq.coms.util.IdGenerator;
import com.xiaoq.sites.entity.MerchantEntity;
import com.xiaoq.sites.entity.SitesAnnouncementEntity;
import com.xiaoq.sites.entity.SitesEntity;
import com.xiaoq.sites.service.IMerchantService;
import com.xiaoq.sites.service.ISitesService;
import com.xiaoq.sites.vo.AnnouncementVo;
import com.xiaoq.sites.vo.SitesAdditionVo;
import com.xiaoq.sites.vo.SitesDetailVo;
import com.xiaoq.sites.vo.SitesMessageVo;
import com.xiaoq.sites.vo.SitesReptilesVo;
import com.xiaoq.system.entity.ZoneMasterEntity;
import com.xiaoq.system.service.IZoneMasterService;
import io.swagger.annotations.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Api(tags={"B端 景区相关接口"})
@RestController
@RequestMapping("/api/v1")
public class SitesEndpoint2B {
	
	private static final class SiteDetailResponse extends GenericDataResponse<SitesDetailVo> {};
	
	private static final class SitesMessageDataResponse extends GenericDataResponse<SitesMessageVo> {}
	
	private Logger logger = LoggerFactory.getLogger(SitesEndpoint2B.class);

	@Autowired
	//@Reference(interfaceClass=ISitesApi.class, check=false, version="1.0.0")
	private ISitesService sitesService;
	
	@Reference(interfaceClass=IMerchantMgrApi.class,check=false,version="1.0.0")
	private IMerchantMgrApi merchantApi;
	
	@Autowired
	private IMerchantService merchantSer;

	@Autowired
	private IdGenerator idGenerator;

	@Autowired
	private IZoneMasterService zoneMasterService;
	
	@Autowired
	private RedisTemplate4JedisCluster redisTemplate;

	@Reference(interfaceClass=IMerchantMgrApi.class, check=false, version="1.0.0")
	private IMerchantMgrApi merchantMgrDubboApi;
	
	@ApiOperation(value = "景区对接爬虫(对应的图片上传七牛云)", notes = "景区对接爬虫")
	@ApiResponses({ @ApiResponse(code = 200, response = GenericResponse.class, message = "景区对接爬虫") })
	@PostMapping(value = "/sites/reptiles", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> reptilesSites(HttpServletRequest request,
			@RequestBody SitesReptilesVo sitesReptilesVo) {
		
		String sitesId = sitesReptilesVo.getId();
		SitesEntity sitesEntity = new SitesEntity();
		if(StringUtils.isEmpty(sitesId)){
			sitesId = idGenerator.nextId();
			
		}
		sitesEntity.setId(sitesId);
		if(sitesReptilesVo.getCenterLatitude()!=null){
			sitesEntity.setCenterLatitude(sitesReptilesVo.getCenterLatitude());
		}else{
			return GenericResponse.ng("缺少：centerLongitude");
		}
		if(sitesReptilesVo.getCenterLongitude()!=null){
			sitesEntity.setCenterLongitude(sitesReptilesVo.getCenterLongitude());
		}else{
			return GenericResponse.ng("缺少：CenterLongitude");
		}
		if(sitesReptilesVo.getMainEntryLongitude()!=null){
			sitesEntity.setMainEntryLongitude(sitesReptilesVo.getMainEntryLongitude());
		}else{
			sitesEntity.setMainEntryLongitude(sitesReptilesVo.getCenterLongitude());
		}
		if(sitesReptilesVo.getMainEntryLatitude()!=null){
			sitesEntity.setMainEntryLatitude(sitesReptilesVo.getMainEntryLatitude());
		}else{
			sitesEntity.setMainEntryLatitude(sitesReptilesVo.getCenterLatitude());
		}
		if(sitesReptilesVo.getName()!=null){
			sitesEntity.setName(sitesReptilesVo.getName());
		}else{
			return GenericResponse.ng("缺少：Name");
		}
		if(sitesReptilesVo.getAddress()!=null){
			sitesEntity.setAddress(sitesReptilesVo.getAddress());
		}else{
			sitesEntity.setAddress(sitesReptilesVo.getName());
		}
		if(sitesReptilesVo.getShortName()!=null){
			sitesEntity.setShortName(sitesReptilesVo.getShortName());
		}else{
			sitesEntity.setShortName(sitesReptilesVo.getName());
		}
		if(sitesReptilesVo.getMainImgUrl()!=null){
			sitesEntity.setMainImgUrl(sitesReptilesVo.getMainImgUrl());
		}else{
			return GenericResponse.ng("缺少：MainImgUrl");
		}
		if(sitesReptilesVo.getLogo()!=null){
			sitesEntity.setLogo(sitesReptilesVo.getLogo());
		}else{
			sitesEntity.setLogo(sitesReptilesVo.getMainImgUrl());
		}
		if(sitesReptilesVo.getLevels()!=null){
			sitesEntity.setLevels(sitesReptilesVo.getLevels());
		}else{
			sitesEntity.setLevels(5);
		}
		if(sitesReptilesVo.getZoneProvince()!=null){
			sitesEntity.setZoneProvince(sitesReptilesVo.getZoneProvince());
		}else{
			sitesEntity.setZoneProvince("");
		}
		if(sitesReptilesVo.getZoneCity()!=null){
			sitesEntity.setZoneCity(sitesReptilesVo.getZoneCity());
		}else{
			return GenericResponse.ng("缺少：ZoneCity");
		}
		if(sitesReptilesVo.getZoneDistrict()!=null){
			sitesEntity.setZoneDistrict(sitesReptilesVo.getZoneDistrict());
		}else{
			sitesEntity.setZoneDistrict("");
		}
		if(sitesReptilesVo.getIntroduction()!=null){
			sitesEntity.setIntroduction(sitesReptilesVo.getIntroduction());
		}else{
			sitesEntity.setIntroduction(sitesReptilesVo.getName());
		}
		if(sitesReptilesVo.getDetailInfo()!=null){
			sitesEntity.setDetailInfo(sitesReptilesVo.getDetailInfo());
		}else{
			sitesEntity.setDetailInfo("本景区风景秀丽景色宜人！适合游客四季游玩，能给你带来不一样的体验！");
		}
		if(sitesReptilesVo.getOpenSchedule()!=null){
			sitesEntity.setOpenSchedule(sitesReptilesVo.getOpenSchedule());
		}else{
			sitesEntity.setOpenSchedule("上午8：:0-下午17:00");
		}
		if(sitesReptilesVo.getImgUrls()!=null&&sitesReptilesVo.getImgUrls().size()!=0){
			sitesEntity.setImgUrls(sitesReptilesVo.getImgUrls());
		}else{
			List<String> imgUrls = new ArrayList<>();
			imgUrls.add(sitesReptilesVo.getMainImgUrl());
			sitesEntity.setImgUrls(imgUrls);
		}
		if(sitesReptilesVo.getTags()!=null && sitesReptilesVo.getTags().size()!=0){
			sitesEntity.setTags(sitesReptilesVo.getTags());
		}else{
			List<String> tags = new ArrayList<>();
			tags.add("风景秀丽");
			tags.add("景色宜人");
			tags.add("适合四季游玩");
			sitesEntity.setTags(tags);
		}
		if(sitesReptilesVo.getNotice()!=null){
			sitesEntity.setNotice(sitesReptilesVo.getNotice());
		}else{
			sitesEntity.setNotice("本平台所有景区都需要提前一个工作日预约！");
		}
		if(sitesReptilesVo.getPrefPolicy()!=null){
			sitesEntity.setPrefPolicy(sitesReptilesVo.getPrefPolicy());
		}else{
			sitesEntity.setPrefPolicy("学生票半价");
		}
		if(sitesReptilesVo.getTips()!=null){
			sitesEntity.setTips(sitesReptilesVo.getTips());
		}else{
			sitesEntity.setTips("请游客游览时注意安全！");
		}
		
		if(sitesReptilesVo.getPhoneNum()!=null){
			sitesEntity.setPhoneNum(sitesReptilesVo.getPhoneNum());
		}else{
			sitesEntity.setPhoneNum("15639011866");
		}
		if(sitesReptilesVo.getAnnouncement()!=null){
			sitesEntity.setAnnouncement(sitesReptilesVo.getAnnouncement());
		}else{
			sitesEntity.setAnnouncement("在景区游玩请注意安全");
		}
		if(sitesReptilesVo.getAvgTime()!=null){
			sitesEntity.setAvgTime(sitesReptilesVo.getAvgTime());
		}else{
			sitesEntity.setAvgTime("5小时");
		}
		if(sitesReptilesVo.getBestPeriod()!=null){
			sitesEntity.setBestPeriod(sitesReptilesVo.getBestPeriod());
		}else{
			sitesEntity.setBestPeriod("4月-6月;9月-11月");
		}
		sitesEntity.setDelFlag("0");
		sitesEntity.setStatus("10");
		sitesEntity.setMaxRadius(1000L);
		//设置省市区名称
		ZoneMasterEntity provinceZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneProvince());
		ZoneMasterEntity cityZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneCity());
		ZoneMasterEntity districtZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneDistrict());
		Integer provinceSitesCounts = provinceZone.getSitesCount();
		if(provinceSitesCounts==null){
			provinceSitesCounts=0;
		}
		provinceZone.setSitesCount(provinceSitesCounts+1);
		zoneMasterService.save(provinceZone);
		
		Integer citySitesCounts = cityZone.getSitesCount();
		if(citySitesCounts==null){
			citySitesCounts=0;
		}
		cityZone.setSitesCount(citySitesCounts+1);
		zoneMasterService.save(cityZone);
		
		Integer districtSitesCounts = districtZone.getSitesCount();
		if(districtSitesCounts==null){
			districtSitesCounts=0;
		}
		districtZone.setSitesCount(districtSitesCounts+1);
		zoneMasterService.save(districtZone);
		
		
		sitesEntity.setZoneProvinceName(provinceZone==null?"":provinceZone.getName());
		sitesEntity.setZoneCityName(cityZone==null?"":cityZone.getName());
		sitesEntity.setZoneDistrictName(districtZone==null?"":districtZone.getName());
		sitesEntity.setAuthenStatus("00");
		sitesService.addSites(sitesEntity);
		return GenericResponse.ok();

	}
	
	@ApiOperation(value="(对接运营后端)删除景区" ,notes="(对接运营后端)删除景区")
	@ApiResponses({
		@ApiResponse(code=200, response=GenericResponse.class, message="(对接运营后端)删除景区")
	})
	@DeleteMapping(value="/sites/reptiles", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> deleteSites(@RequestParam(value="id",required=true)@ApiParam(value="景区id",required=true)String id){

		boolean result = sitesService.delSites(id);
		if(result){
			return GenericResponse.ok();
		}
		return GenericResponse.ng("更新失败");
	}
	@ApiOperation(value = "(对接运营后端)修改景区", notes = "(对接运营后端)修改景区")
	@ApiResponses({ @ApiResponse(code = 200, response = GenericResponse.class, message = "(对接运营后端)修改景区") })
	@PutMapping(value = "/sites/reptiles", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> updateSites4OptBack(
			@RequestBody SitesAdditionVo sitesAdditionVo,
			HttpServletRequest request) {
		String userId = (String) request.getAttribute("userId");
		String shopId = redisTemplate.get(ConstantUtil.REDIS_PREFIX_MANAGER_SHOP_RELATION, userId);
		sitesAdditionVo.setId(shopId);
		SitesEntity sitesEntity = new SitesEntity();
		BeanUtils.copyProperties(sitesAdditionVo, sitesEntity);

		//设置省市区名称
		ZoneMasterEntity provinceZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneProvince());
		ZoneMasterEntity cityZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneCity());
		ZoneMasterEntity districtZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneDistrict());
		sitesEntity.setZoneProvinceName(provinceZone==null?"":provinceZone.getName());
		sitesEntity.setZoneCityName(cityZone==null?"":cityZone.getName());
		sitesEntity.setZoneDistrictName(districtZone==null?"":districtZone.getName());

		boolean result = sitesService.updateSites(sitesEntity);
		if (result) {
			return GenericResponse.ok();
		}
		return GenericResponse.ng("更新失败");
	}
	
	@ApiOperation(value = "景区信息（设置中心使用）", notes = "景区信息（设置中心使用）")
	@ApiResponses({ @ApiResponse(code = 200, response = SitesMessageDataResponse.class, message = "景区信息（设置中心使用）") })
	@GetMapping(value = "/sites/message", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> sitesMessageInfo(HttpServletRequest request) {
		String userId = (String) request.getAttribute("userId");
		String shopId = redisTemplate.get(ConstantUtil.REDIS_PREFIX_MANAGER_SHOP_RELATION, userId);
		SitesEntity sites = sitesService.findById(shopId);
		SitesMessageVo sitesMessageVo = new SitesMessageVo();
		BeanUtils.copyProperties(sites, sitesMessageVo);
		String ahthStatus = sitesMessageVo.getAuthenStatus();
		if(StringUtils.isEmpty(ahthStatus)){
			sitesMessageVo.setAuthenStatus("00");
		}
		MerchantMgrInfo4Vo merchantMgr = merchantApi.findMerMgr(userId);
		sitesMessageVo.setPhoneNum(merchantMgr.getMobile());
		sitesMessageVo.setShopType(merchantMgr.getShopType());
		return SitesMessageDataResponse.okWithData(sitesMessageVo);
		
	}
	
	@ApiOperation(value = "查询景区详情", notes = "根据ID查询景区详情")
	@ApiResponses({ @ApiResponse(code = 200, response = SiteDetailResponse.class, message = "景区详情") })
	@GetMapping(value = "/sites/detail", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> detailInfo(HttpServletRequest request) {

		String userId = (String) request.getAttribute("userId");
		String shopId = redisTemplate.get(ConstantUtil.REDIS_PREFIX_MANAGER_SHOP_RELATION, userId);
		SitesEntity sites = sitesService.findById(shopId);

		if (StringUtils.isBlank(shopId) || sites == null) {
			return GenericResponse.ng("景区不存在");
		}

		SitesDetailVo sitesDetailVo = new SitesDetailVo();
		Long capacity = sites.getCapacity();
		if (sites != null && StringUtils.isNotBlank(sites.getId())) {
			sitesDetailVo.setAddress(sites.getAddress());
			sitesDetailVo.setAvgTime(sites.getAvgTime());
			sitesDetailVo.setBestPeriod(sites.getBestPeriod());
			sitesDetailVo.setCenterLatitude(sites.getCenterLatitude());
			sitesDetailVo.setCenterLongitude(sites.getCenterLongitude());
			sitesDetailVo.setDetailInfo(sites.getDetailInfo());
			sitesDetailVo.setEnterCert(sites.getEnterCert());
			sitesDetailVo.setId(sites.getId());
			sitesDetailVo.setImgUrls(sites.getImgUrls());
			sitesDetailVo.setIntroduction(sites.getIntroduction());
			if(sites.getLevels()!=null){
				sitesDetailVo.setLevels(sites.getLevels());
			}
			sitesDetailVo.setMainEntryLatitude(sites.getMainEntryLatitude());
			sitesDetailVo.setMainEntryLongitude(sites.getMainEntryLongitude());
			sitesDetailVo.setMainImgUrl(sites.getMainImgUrl());
			sitesDetailVo.setMerchantId(sites.getMerchantId());
			sitesDetailVo.setName(sites.getName());
			sitesDetailVo.setNotice(sites.getNotice());
			sitesDetailVo.setOpenSchedule(sites.getOpenSchedule());
			sitesDetailVo.setPhoneNum(sites.getPhoneNum());
			sitesDetailVo.setPrefPolicy(sites.getPrefPolicy());
			sitesDetailVo.setShortName(sites.getShortName());
			sitesDetailVo.setTags(sites.getTags());
			sitesDetailVo.setTips(sites.getTips());
			sitesDetailVo.setTraficTips(sites.getTraficTips());
			sitesDetailVo.setZoneCity(sites.getZoneCity());
			sitesDetailVo.setZoneCityName(sites.getZoneCityName());
			sitesDetailVo.setZoneDistrictName(sites.getZoneDistrictName());
			sitesDetailVo.setZoneProvinceName(sites.getZoneProvinceName());

			ZoneMasterEntity zoneMasterEntity = zoneMasterService.getZoneMasterByCode(sites.getZoneCity());

			if (zoneMasterEntity != null && zoneMasterEntity.getName() != null) {
				sitesDetailVo.setZoneCityName(zoneMasterEntity.getName());
			} else {
				sitesDetailVo.setZoneCityName("");
			}

			sitesDetailVo.setZoneDistrict(sites.getZoneDistrict());
			sitesDetailVo.setZoneProvince(sites.getZoneProvince());
			sitesDetailVo.setMaxRadius(sites.getMaxRadius());
			sitesDetailVo.setStatus(sites.getStatus());
			sitesDetailVo.setCapacity(capacity);
		}

		AnnouncementVo announcementVo = null;
		List<AnnouncementVo> announcementVoList = new ArrayList<>();
		List<SitesAnnouncementEntity> sitesAnnouncementList = sitesService.findSitesAnnouncementListBySitesId(shopId);
		if (CollectionUtils.isNotEmpty(sitesAnnouncementList)) {
			for (SitesAnnouncementEntity sitesAnnouncement : sitesAnnouncementList) {
				announcementVo = new AnnouncementVo();
				announcementVo.setContent(sitesAnnouncement.getContent());
				announcementVo.setId(sitesAnnouncement.getId());
				announcementVo.setPubTime(sitesAnnouncement.getPubTime());
				announcementVo.setTitle(sitesAnnouncement.getTitle());
				announcementVo.setWarnLevel(sitesAnnouncement.getWarnLevel());

				announcementVoList.add(announcementVo);
			}
			sitesDetailVo.setAnnouncements(announcementVoList);
		}

		return SiteDetailResponse.okWithData(sitesDetailVo);
	}


	@ApiOperation(value = "添加景区", notes = "添加景区")
	@ApiResponses({ @ApiResponse(code = 200, response = GenericResponse.class, message = "添加景区") })
	@PostMapping(value = "/sites", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> addSites(HttpServletRequest request,
			@RequestBody SitesAdditionVo sitesAdditionVo) {
		
		String userId = (String) request.getAttribute("userId");
		MerchantMgrInfo4Vo merchantMgr = merchantMgrDubboApi.findMerMgr(userId);
		String shopId = merchantMgr.getShopId();
		if(StringUtils.isNotBlank(shopId)){
			return GenericDataResponse.ng("您已经创建过景区不能重复创建！");
		}
		String sitesId = sitesAdditionVo.getId();
		//TODO 可能会出现有人恶意认领的现象
		SitesEntity sitesEntity = null;
		if(StringUtils.isEmpty(sitesId)){
			String name = sitesAdditionVo.getName();
			List<SitesEntity> sitesEntityList = sitesService.findByName(name);
			if(sitesEntityList!=null&&sitesEntityList.size()!=0){
				return GenericDataResponse.ng("您创建的景区已经被小Q旅行收录，请前去认领！");
			}
			sitesId = idGenerator.nextId();
			sitesEntity = new SitesEntity();
			BeanUtils.copyProperties(sitesAdditionVo, sitesEntity);
			sitesEntity.setId(sitesId);
			sitesEntity.setDelFlag("0");
		}else{
			
			sitesEntity = sitesService.findById(sitesId);
			if(sitesEntity==null){
				return GenericDataResponse.ng("您认领的景区有误，请重新添加或者重新认领");
			}
			String status = sitesEntity.getStatus();
			if(status==null){
				status = "00";
			}
			if("200".equals(status)){
				return GenericResponse.ng("该景区已经上线,不能被认领！");
			}
		}
		String merchantId = idGenerator.nextId();
		String merchantMgrId = userId;

		MerchantEntity merchant = new MerchantEntity();
		MerchantMgrInfo4Vo merchantMgrInfo = new MerchantMgrInfo4Vo();

		merchantMgrInfo.setId(merchantMgrId);
		merchantMgrInfo.setMerchantId(merchantId);
		merchantMgrInfo.setShopId(sitesId);
		merchantMgrInfo.setShopType("10");

		merchant.setId(merchantId);
		merchant.setStatus("00");

		

		//设置省市区名称
		ZoneMasterEntity provinceZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneProvince());
		ZoneMasterEntity cityZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneCity());
		ZoneMasterEntity districtZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneDistrict());
		sitesEntity.setZoneProvinceName(provinceZone==null?"":provinceZone.getName());
		sitesEntity.setZoneCityName(cityZone==null?"":cityZone.getName());
		sitesEntity.setZoneDistrictName(districtZone==null?"":districtZone.getName());
		sitesEntity.setAuthenStatus("00");
		sitesEntity.setMerchantId(merchantId);
		boolean result = sitesService.addSites(sitesEntity);
		if (result) {
			merchantSer.save(merchant);
			merchantMgrDubboApi.save(merchantMgrInfo);
			merchantMgrDubboApi.addRole(sitesId);
			merchantMgrDubboApi.updateStep(userId, 2);
			redisTemplate.set(ConstantUtil.REDIS_PREFIX_MANAGER_SHOP_RELATION, userId, sitesId);
			return GenericResponse.ok();
		}
		return GenericResponse.ng("添加失败");

	}
	
	
	@ApiOperation(value = "修改景区", notes = "修改景区")
	@ApiResponses({ @ApiResponse(code = 200, response = GenericResponse.class, message = "修改景区") })
	@PutMapping(value = "/sites", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> updateSites(
			@RequestBody SitesAdditionVo sitesAdditionVo,
			HttpServletRequest request) {
		String userId = (String) request.getAttribute("userId");
		String shopId = redisTemplate.get(ConstantUtil.REDIS_PREFIX_MANAGER_SHOP_RELATION, userId);
		sitesAdditionVo.setId(shopId);
		SitesEntity sitesEntity = new SitesEntity();
		BeanUtils.copyProperties(sitesAdditionVo, sitesEntity);

		//设置省市区名称
		ZoneMasterEntity provinceZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneProvince());
		ZoneMasterEntity cityZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneCity());
		ZoneMasterEntity districtZone = zoneMasterService.getZoneMasterByCode(sitesEntity.getZoneDistrict());
		sitesEntity.setZoneProvinceName(provinceZone==null?"":provinceZone.getName());
		sitesEntity.setZoneCityName(cityZone==null?"":cityZone.getName());
		sitesEntity.setZoneDistrictName(districtZone==null?"":districtZone.getName());

		boolean result = sitesService.updateSites(sitesEntity);
		if (result) {
			return GenericResponse.ok();
		}
		return GenericResponse.ng("更新失败");
	}
	
	
	@ApiOperation(value="删除景区" ,notes="删除景区")
	@ApiResponses({
		@ApiResponse(code=200, response=GenericResponse.class, message="删除景区")
	})
	@DeleteMapping(value="/sites/{id}", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
	public ResponseEntity<?> delSites(@RequestParam(value="id",required=true)@ApiParam(value="id",required=true)String id){

		boolean result = sitesService.delSites(id);
		if(result){
			return GenericResponse.ok();
		}
		return GenericResponse.ng("更新失败");
	}
}